import { RouterModule, Routes } from '@angular/router'
import { NgModule } from '@angular/core'

import { AppComponent } from '../component/manager/app/app.component'
import { ConsoleComponent } from '../component/manager/console/console.component'

import { HomeComponent } from '../component/manager/home/home.component';
import { AlgorithmListComponent } from '../component/manager/algorithm-list/algorithm-list.component';
import { AlgorithmInfoComponent } from '../component/manager/algorithm-info/algorithm-info.component';
import { AlgorithmEditComponent } from '../component/manager/algorithm-edit/algorithm-edit.component';
import { RecordComponent } from '../component/manager/record/record.component';

const routes: Routes = [
  {
    path: 'console',
    component: ConsoleComponent,
    children: [
      {
        path: 'home',
        component: HomeComponent
      },

      {
        path: 'algorithm-list',
        component: AlgorithmListComponent
      },

      {
        path: 'algorithm-info/:id',
        component: AlgorithmInfoComponent
      },

      {
        path: 'algorithm-edit/:id/:code',
        component: AlgorithmEditComponent
      },

      {
        path: 'record',
        component: RecordComponent
      }
    ]
  },

  {
    path: '',
    redirectTo: '/console/home',
    pathMatch: 'full'
  }
]

@NgModule({
  imports: [
    RouterModule.forRoot(routes, { useHash: true })
  ],
  exports: [
    RouterModule
  ]
})
export class AppRoutingModule {}
